/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package zombieville.engine;
import java.lang.Integer;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author -Gui-
 */
public class Timer extends Thread{
    
    private TimerListener listener;
    private int tempo;
    private int contTempo;
    
    public Timer(TimerListener listener, int tempo){
        
        this.listener = listener;
        this.tempo = tempo;
        contTempo = 100;
    }
    
    @Override
    public void run(){
        
        while(true){
            try {
                this.sleep(tempo);
            } catch (InterruptedException ex) {
                Logger.getLogger(Timer.class.getName()).log(Level.SEVERE, null, ex);
            }
            
            contTempo = (contTempo + tempo) % 10000;
            listener.acaoExecutada();
        }
       
    }

    /**
     * @return the contTempo
     */
    public int getContTempo() {
        return contTempo;
    }
    
}
